const { makeExecutableSchema  } = require('apollo-server-express')
const typeDefs = require('./type-defs')
const userResolvers = require('./resolves/user.js')
const articleResolvers = require('./resolves/article.js')
const UpperCaseDirective = require('./schema-directive/upper.js')
const AuthDirective = require('./schema-directive/auth.js')

const schema = makeExecutableSchema({
  typeDefs,
  resolvers: [
    userResolvers,
    articleResolvers
  ],
  schemaDirectives: {
    upper: UpperCaseDirective,
    auth: AuthDirective
  }
})

module.exports = schema
